package com.weight.system.command.service.impl;

import com.weight.system.command.PO.CommandInfo;
import com.weight.system.command.service.CommandInfoService;
import com.weight.system.command.DAO.CommandInfoMapper;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import org.springframework.transaction.annotation.Transactional;
import com.weight.common.util.CommonUtils;
import lombok.extern.slf4j.Slf4j;

/**
 * 指令表
 */
@Service
@Transactional
@Slf4j
public class CommandInfoServiceImpl implements CommandInfoService {

	@Autowired
	private CommandInfoMapper commandInfoMapper;


	/**
	 * 查询指令信息--条件查询
	 * @param map
	 * @return
	 */
	@Override
	public List<CommandInfo> findCommandInfoByT(Map map){
		return commandInfoMapper.findCommandInfoByT(map);
	}

	/**
	 * 查询指令信息--条件，分页查询
	 * @param currentPage
	 * @param pageSize
	 * @param map
	 * @return
	 */
	@Override
	public List<CommandInfo> findCommandInfoByPage(int currentPage,int pageSize,Map map){
		PageHelper.startPage(currentPage, pageSize);
		List<CommandInfo> commandInfoList = commandInfoMapper.findCommandInfoByT(map);
		return commandInfoList;
	}

	/**
	 * 查询指令信息--查询全部
	 * @return
	 */
	@Override
	public List<CommandInfo> findAll(){
		return commandInfoMapper.findAll();
	}

	/**
	 * ID查询指令信息
	 * @param map
	 * @return
	 */
	@Override
	public CommandInfo findByCommandInfoId(Map map){
		CommandInfo commandInfo=commandInfoMapper.findByCommandInfoId(map);
		CommonUtils.validateExistObj(commandInfo,map);
		return commandInfo;
	}

	/**
	 * ID查询指令信息-批量
	 * @param commandInfoIdList
	 * @return
	 */
	@Override
	public List findByCommandInfoIdList(List commandInfoIdList){
		List idList = commandInfoMapper.findByCommandInfoIdList(commandInfoIdList);
		CommonUtils.validateExistList(idList,commandInfoIdList);
		return idList;
	}

	/**
	 * 添加指令
	 * @param commandInfo
	 */
	@Override
	public void insertCommandInfo(CommandInfo commandInfo){
		commandInfoMapper.insertCommandInfo(commandInfo);
	}

	/**
	 * 批量添加指令
	 * @param commandInfoList
	 */
	@Override
	public void insertCommandInfoBatch(List<CommandInfo> commandInfoList){
		commandInfoMapper.insertCommandInfoBatch(commandInfoList);
	}

	/**
	 * 修改指令
	 * @param commandInfo
	 */
	@Override
	public void updateCommandInfo(CommandInfo commandInfo){
		commandInfoMapper.updateCommandInfo(commandInfo);
	}

	/**
	 * 修改指令
	 * @param commandInfo
	 */
	@Override
	public void updateCommandInfoLimt(CommandInfo commandInfo){
		commandInfoMapper.updateCommandInfoLimt(commandInfo);
	}

	/**
	 * 物理删除指令
	 * @param map
	 */
	@Override
	public void deleteByCommandInfoId(Map map){
		commandInfoMapper.deleteByCommandInfoId(map);
	}

	/**
	 * 批量物理删除指令
	 * @param commandInfoIdList
	 */
	@Override
	public void deleteByCommandInfoIdBatch(List commandInfoIdList){
		commandInfoMapper.deleteByCommandInfoIdBatch(commandInfoIdList);
	}

	/**
	 * 状态删除指令
	 * @param map
	 */
	@Override
	public void upDelByCommandInfoId(Map map){
		commandInfoMapper.upDelByCommandInfoId(map);
	}

	/**
	 * 批量状态删除指令
	 * @param commandInfoList
	 */
	@Override
	public void upDelByCommandInfoIdBatch(Map<String, Object> map){
		commandInfoMapper.upDelByCommandInfoIdBatch(map);
	}

}